import { axios } from "../../utils/request";

const api = {
    list: "/member/order/page",
    save: "/member/order/save",
    aliPay: "/sby/aliPay/getAliPayUrl",
    wxPay: "/sby/weXin/pay",
    saveRenewOrder: "/member/order/saveRenew",
    getOrderDetail: "/member/order/getOrderDetail",
    deleteOrder: "/member/order/delete",
    getAliPayUrlFromPayment:"/sby/aliPay/getAliPayUrlFromPayment",
    getWeXinPayImageFromPayOrder:"sby/weXin/payFormPayOrder",
};

/**
 * 列表
 */
export function orderPage(parameter) {
  return axios({
    url: api.list,
    method: "get",
    params: parameter
  });
}

/**
 * 保存订单
 */
export function saveOrder(parameter) {
  return axios({
    url: api.save,
    method: "post",
    data: parameter
  });
}

/**
 * 保存续费订单
 */
export function saveRenewOrder(data) {
  return axios({
    url: api.saveRenewOrder,
    method: "post",
    data: data
  });
}

/**
 * 支付宝支付
 */
export function aliPay(parameter) {
  return axios({
    url: api.aliPay,
    method: "get",
    params: parameter
  });
}

/**
 * 获取 支付宝 支付地址（支付订单）
 */
 export function getAliPayUrlFromPayment(parameter) {
    return axios({
      url: api.getAliPayUrlFromPayment,
      method: "get",
      params: parameter
    });
  }

  /**
 * 获取 微信支付码（支付订单）
 */
 export function getWeXinPayImageFromPayOrder(parameter) {
    return axios({
      url: api.getWeXinPayImageFromPayOrder,
      method: "get",
      params: parameter
    });
  }
/**
 * 微信支付
 */
export function wxPay(parameter) {
  return axios({
    url: api.wxPay,
    method: "get",
    params: parameter
  });
}

/**
 * 订单详情
 */
export function getOrderDetail(parameter) {
  return axios({
    url: api.getOrderDetail,
    method: "get",
    params: parameter
  });
}

/**
 * 删除订单
 */
export function deleteOrder(parameter) {
  return axios({
    url: api.deleteOrder,
    method: "get",
    params: parameter
  });
}